//子弹基础类(10 开始)
//1.生成子弹图片
//2.更换子弹的刚体
//3.负责子弹的移动，或者给力
//4.负责子弹的停止

module py2Obj {

	export class basicBullet extends basicObj {
		//保存外部的物理世界

		public pointList: egret.Point[] = [];

		public constructor(world: any, gamePanle: any, romveSkins: any) {
			super(world, gamePanle, romveSkins);
			this.objkind = 100;
		}
		public init() {
			super.init();
		}
		public createMyRigidbody(): p2.Body {
			//this.bool=true;


			var world: P2World = this.m_world;
			var skin: MImage = this.createSkin("ball2_png");
			var body: p2.Body = world.createCircleBodyShape(13, p2.Body.KINEMATIC);
			body.userData.skin = skin;
			body.userData.data = this;
			body.mass = 0;//质量设置为0，就可以按规定方向发射，等发生碰撞之后再给球质量
			//body.gravityScale=0;
			var shape = body.shapes[0];
			//	shape.collisionGroup = 2;//010与001为0，010与110为1
			shape.collisionMask = 6;

			//this.label.x = this.m_body.position[0];
			//this.label.y = this.m_body.position[1];
			// shape.collisionMask=2;
			// trace(shape.collisionGroup,shape.collisionMask)
			return body;
		}
		public createMyRigidbody1(): p2.Body {
			var world: P2World = this.m_world;
			var skin: MImage = this.createSkin("purpleBall_png");
			var body: p2.Body = world.createCircleBodyShape(13, p2.Body.KINEMATIC);
			body.userData.skin = skin;
			body.userData.data = this;
			body.mass = 0;//质量设置为0，就可以按规定方向发射，等发生碰撞之后再给球质量
			//body.gravityScale=0;
			var shape = body.shapes[0];
			//	shape.collisionGroup = 2;//010与001为0，010与110为1
			shape.collisionMask = 6;

			//this.label.x = this.m_body.position[0];
			//this.label.y = this.m_body.position[1];
			// shape.collisionMask=2;
			// trace(shape.collisionGroup,shape.collisionMask)
			return body;
		}
		public getCollision(otherBody: basicObj) {
			super.getCollision(otherBody);
			// if (otherBody.objkind == 103) {	
			// 	this.removebullet(this);
			// }
		}
		public removeBasicbullet(ba: basicBullet) {
			this.m_world.removeBodys.push(ba.getBody());
			this.m_removeSkins.push(ba.getBody().userData.skin);
		}
	}
}